<template>
	<view class="content">
		<view class="report_content">
			<view class="survey_title">
				举报内容
			</view>
			<view class="report_item" v-for="(item,index) in list" :key="index" @click="changeItem(index)">
				<text>{{item.title}}</text>
				<image :src="item.isClick?'../../static/img/checked.png':'../../static/img/noChecked.png'" mode="" style="width: 27rpx;height: 27rpx;"></image>
			</view>
			
		</view>
		<view class="report_input">
			<view class="report_input_title">
				<text>详细信息描述</text>
				<text>{{content.length}}/200</text>
			</view>
			<textarea v-model="content" maxlength="200" placeholder="请详细描述您的投诉内容" />
		</view>
		<view style="box-sizing: border-box;padding:0 30rpx;position: absolute;bottom: 58rpx;left: 0;right: 0;">
			<view class="pay_btn" @click="submitFun">
				<text>	确定</text>
			</view>
		</view>
	</view>
</template>

<script>
	export default{
		data(){
			return {
				id:"",
				list:[{
					title:"上传描述内容与实际不符",
					isClick:true
				},{
					title:"品牌服务态度恶劣",
					isClick:false
				},{
					title:"违法、政治敏感内容",
					isClick:false
				},{
					title:"其他",
					isClick:false
				}],
				reportContent:'上传描述内容与实际不符',
				content:""
			}
		},
		onLoad(data) {
			this.id=data.id;
		},
		onShow() {
			this.content="";
		},
		methods:{
			changeItem(index){
				this.list.forEach((a,i)=>{
					a.isClick=false;
					if(i==index){
						a.isClick=true;
					}
				})
				this.reportContent=this.list[index].title;
			},
			//提交
			submitFun(){
				this.$http.post('/api/shop/report',{
							"reportContent": this.reportContent,
							"reportDesc": this.content,
							"targetId": this.id
				},'application/json').then((data)=>{
					if(data.data.code==200){
						uni.showToast({
							title: '投诉成功!',
							icon: "success",
							duration: 2000,
						
						});
						setTimeout(()=>{
							uni.navigateBack();
						
						},1000)
					}else{
						uni.showToast({
							title: data.data.message,
							icon: "none",
							duration: 2000,
						
						});
					}
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	@import '@/static/css/report.scss'
</style>
